<%@ page language="java"
	import="java.util.*,com.shop.dao.*,com.shop.domain.*"
	contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!doctype html>
<html lang="cmn-Hans-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<!--引入bootstrap的CSS文件 -->
<link rel="stylesheet" href="../css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../css/bootstrap-theme.min.css"
	type="text/css" />
<link rel="stylesheet" href="../css/admin.css" />
<!--引入jquery的js文件-->

<script type="text/javascript" src="../js/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.js"></script>
<script src="../js/admin.js"></script>
</head>
<body>
	<%!Admin a = new Admin();
	%>
	<%
		try {
			request.setCharacterEncoding("UTF-8");
			String username = request.getParameter("username");
			if(username != null && !username.equals("")){
			AdminDao ad = new AdminDao();
			Admin a = new Admin();
			a = ad.find(username);
			if (a != null) {
				request.setAttribute("Admin", a);
			}else{
			    out.println("<script>alert('没找到！');</script>");
			}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	%>
	<div class=""container"" style="margin-bottom:0">
<h1></h1>
	<form action="queryAdmin.jsp" class="form-horizontal" role="form">
		<div class="form-group">
			<label class="col-sm-2 control-label">请输入管理员名：</label>
			<div class="col-sm-4"><input class="form-control" name="username" type="text" />
			</div>
			<div class="col-sm-4">
			<button class="btn btn-default" type="submit" value="查询" onclick="adminIsEmpty()">
			查询</button>
			</div>
		</div>
	</form>
	<c:if test="${not empty requestScope.Admin}">
		<!--表格-->
		<table class="table">
			<thead>
				<tr>
					<th width="15%">管理员名</th>
					<th width="20%">密码</th>
					<th width="20%">邮箱</th>
					<th width="20%">等级</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td width="15%" id="username" 
						>${requestScope.Admin.username}</td>
					<td width="20%">${requestScope.Admin.password}</td>
					<td width="20%">${requestScope.Admin.email}</td>
					<td width="20%">${requestScope.Admin.level}</td>
					<td align="center"><input id="edit" type="button" value="修改"
						class="btn" onclick="editAdmin('${requestScope.Admin.username}')">
						<input id="del" type="button" value="删除" class="btn"
						onclick="delAdmin('${requestScope.Admin.username}')"></td>
				</tr>
			</tbody>
		</table>
	</c:if>
	</div>
</body>
</html>